import request from '@/utils/request'

/**
 *获取所有角色列表
 * @param {Object}  需要的参数page和pagesize，get请求
 * @returns 请求的结果，promise对象
 */
export const getRoleList = (params) => request.get('/sys/role', { params })

// 根据ID删除角色
export const delRoleById = (id) => request.delete(`/sys/role/${id}`)

// 添加角色
export const addRole = (data) => request.post('/sys/role', data)

// 根据ID更新角色
export const editRole = (data) => request.put(`/sys/role/${data.id}`, data)

export const getEnableRoles = () => request.get('/sys/role/list/enabled')

// 给角色分配权限
export const assignPerm = (data) => request.put('/sys/role/assignPrem', data)

// 根据ID获取角色详情
export const getRoleDetail = (id) => request.get(`/sys/role/${id}`)
